/*Load data file first: "DiploMid_violent.dta" */ 

/*TABLE 3 RESULTS*/

* The base model: Table 3, Column 1 

logit mzinit lnbet1 cap1 majpow1 logdistance binarycontig binaryalliance jointIGO jointdemo peaceyears _spline1 _spline2 _spline3, cluster(dyadid) nolog 

* The base model: Table 3, Column 2 
xtset dyadid year 
xtgee mzinit lnbet1 cap1 majpow1 logdistance binarycontig binaryalliance jointIGO jointdemo, family(binomial) link(logit) corr(ar1) force robust nolog

logit violentMID lnbet1 cap1 majpow1 logdistance binarycontig binaryalliance jointIGO jointdemo peaceyears _spline1 _spline2 _spline3, cluster(dyadid) nolog 


/*TABLE 4 RESULTS*/

* baseline 
margins, at(lnbet1=( 2.599091 ) cap1=(.0094993) majpow1=(0) binarycontig=(0) binaryalliance=(0) jointIGO=(30.17144) jointdemo=(0) logdistance=(8.19182)) atmeans vsquish post

* betweenness 
margins, at(lnbet1=(2.599091 4.695131) cap1=(.0094993) majpow1=(0) binarycontig=(0) binaryalliance=(0) jointIGO=(30.17144) jointdemo=(0) logdistance=(8.19182)) atmeans vsquish post 
disp  .0006856  -  .000504   

* military cap 
margins, at(cap1=( .0094993 0.03885) lnbet1=(2.599091) majpow1=(0) binarycontig=(0) binaryalliance=(0) jointIGO=(30.17144) jointdemo=(0) logdistance=(8.19182)) atmeans vsquish post 
disp .0005768 -  .000504

* major status 
margins, at(majpow1=(0 1) lnbet1=(2.599091) cap1=(.0094993)  binarycontig=(0) binaryalliance=(0) jointIGO=(30.17144) jointdemo=(0) logdistance=(8.19182)) atmeans vsquish post 
disp .0009807 -   .000504

* contiguity 
margins, at(binarycontig=(0 1) lnbet1=(2.599091) cap1=(.0094993) majpow1=(0) binaryalliance=(0) jointIGO=(30.17144) jointdemo=(0) logdistance=(8.19182)) atmeans vsquish post 
disp  .0068283 -   .000504

* alliance 
margins, at(binaryalliance=(0 1) lnbet1=(2.599091) cap1=(.0094993) majpow1=(0) binarycontig=(0) jointIGO=(30.17144) jointdemo=(0) logdistance=(8.19182)) atmeans vsquish post 
disp .0004643 -  .000504 

* shared IGOs 
margins, at(jointIGO=(30.17144 44.25116) lnbet1=(2.599091) cap1=(.0094993) majpow1=(0) binarycontig=(0) binaryalliance=(0) jointdemo=(0) logdistance=(8.19182)) atmeans vsquish post 
disp .0004404 -  .000504 

* joint democracy 
margins, at(jointdemo=(0 1) jointIGO=(30.17144) lnbet1=(2.599091) cap1=(.0094993) majpow1=(0) binarycontig=(0) binaryalliance=(0) logdistance=(8.19182)) atmeans vsquish post 
disp  .0002941- .000504 


* distance 
margins, at(logdistance=(8.19182 9.04119) jointdemo=(0) jointIGO=(30.17144) lnbet1=(2.599091) cap1=(.0094993) majpow1=(0) binarycontig=(0) binaryalliance=(0)) atmeans vsquish post 
disp  .000395 - .000504

